<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-touch-fullscreen" content="yes" />
		<meta name="format-detection" content="telephone=no"/>
		<meta name="apple-mobile-web-app-status-bar-style" content="black" /> 
		<meta name="msapplication-tap-highlight" content="no" />
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, width=device-width, viewport-fit=cover" />
		<title>启蒙优选-钱包明细</title>
		<link rel="stylesheet" href="__TMPL__/home/public/assets/css/style.css" />
		<link rel="stylesheet" href="__TMPL__/home/public/assets/css/swiper.min.css">
	</head>
	<style>
		.moreList{text-align: center;font-size:.72rem;color:#666;line-height:2.5rem;display: none;}
	</style>
	<body>
		<!-- 钱包明细 --> 
		<div class="moneyIndex">
			<div class="content">
				<div class="order_list">
					<!-- 入账 add-->
					<div class="thisList">
						<foreach name="list" item="vo">
							<a href="javascript:;" class="profit_item flex juscbtween">
								<div class="left">
									<h3>
										{$vo.remark}
										<if condition="$vo.status eq 1 && $vo.type eq 5">
											(处理中)
										<elseif condition="$vo.status eq 2 && $vo.type eq 5">
											(成功)
										<elseif condition="$vo.status eq 3 && $vo.type eq 5">
											(失败，金额返回到账户上)
										</else>
										</if>
									</h3>
									<p>{$vo.add_time}</p>
								</div>
								<div <if condition="$vo.money_way eq 1">class="add"<else/>class="reduce"</if>><h4><if condition="$vo.money_way eq 1">+<elseif condition="$vo.status eq 2"/>-<else/></if>{$vo.money}</h4></div>
							</a>
						</foreach>
					</div>
					<div class="moreList">正在加载</div>
				</div>
				<php>
				  $counts = count($list);
				  if($counts <= 0){
				</php>
					<div class="noHaveData">
						<img src="__TMPL__/home/public/assets/img/noHaveOrder.png" alt="">
						<p>暂无数据</p>
					</div>
				<php>}</php>
			</div>
		</div>
	</body>
	<script rel="stylesheet" src="__TMPL__/home/public/assets/js/jquery-2.0.3.min.js"></script>
  	<script rel="stylesheet" src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
  	<script rel="stylesheet" src="__TMPL__/home/public/assets/js/base.js"></script>
	<script>
		$(function(){
		    //上拉加载
		    var pageNum = 1;
			$(window).scroll(function () {
			    //滚动条滚动时调用
			    var scrollTop = $(this).scrollTop(); //计算已经卷进去滚动条的的高度
			    var scrollHeight = $(document).height(); //当前页面的总高度
			    var windowHeight = $(this).height(); //当前window的高度
			    if (scrollTop+3 + windowHeight >= scrollHeight) {
			    	$('.moreList').show();
			    	pageNum += 1;
				    $.ajax({
				      	url: '/tx_list',
				      	type: 'post',
				      	data: {
				      		'page':pageNum
				      	},
				      	success: function success(d) {
				      		if(d.code == 200){
					      		if(d.data){
					      			var htm = '';
					      			for(let i=0;i<d.data.length;i++){
					      				const item = d.data[i];
					      				htm += `
											<a href="javascript:;" class="profit_item flex juscbtween">
												<div class="left">
													<h3>`+item.remark+(item.status==1&&item.type==5?'(处理中)':item.status==2?&&item.type==5'(成功)':item.status==3&&item.type==5?'(失败，金额返回到账户上)':'')+`</h3>
													<p>`+item.add_time+`</p>
												</div>
												<div class="`+(item.money_way == 1?'add':'reduce')+`"><h4>`+(item.money_way == 1?'+':'-')+``+item.money+`</h4></div>
											</a>`;
					      			}
					      			$('.thisList').append(htm);
					      		}
				      		}
				      		$('.moreList').html('没有更多了')
				      	},
				      	error: function error(e) {
				        	console.log(e);
				      	}
				    })
			    }
			});
		})
	</script>
</html>
